# -*- coding: utf-8 -*-
# @Author : zhangxuchuo
# @Date   : 2021/8/12
# @File   : RP01_EntActControllerCheck_FL.py
# @E-mail : wangbaoshan@bbdservice.com

'''eof
name:疑似实控人与申请人不一致
code:RP01_EntActControllerCheck_FL
tableName:
columnName:
groups:关联方模块
dependencies:OVERVIEW_TAG
type:常用指标
datasourceType:在线指标
description:
eof'''

import sys
import pandas as pd
import json
from datetime import datetime
#从风铃-图谱中取得数据
null_type_list = ['', ' ', None, 'null', 'Null', 'NULL', '/', '-', '--', []]

def RP01_EntActControllerCheck_FL():
    # data = IC_DSJ_2D.get('data')
    try:
        ACTUAL_CONTROL_LIST = OVERVIEW_TAG.get('ACTUAL_CONTROL_LIST', '')
        legalPerson = ratingRequest.get("legalPerson")
        if ACTUAL_CONTROL_LIST not in null_type_list and legalPerson not in null_type_list and isinstance(ACTUAL_CONTROL_LIST, list):
            for i in ACTUAL_CONTROL_LIST:
                name = i.get('Name')
                if name not in null_type_list and name == legalPerson:
                    return 1
        return 0
    except:
        return '缺失值'

result = RP01_EntActControllerCheck_FL()

# 风铃-图谱标签数据
# 通过申请人统一社会代码和 统一社会信用代码（goodCompanyOverviewReq.code）进行匹配
# 实际控制人（ACTUAL_CONTROL_ARRAY）
# if  姓名（NAME） ==申请人姓名：
#     return 1
# else：
#     return 0